package light.mvc.controller.record;

import light.mvc.controller.base.BaseController;
import light.mvc.pageModel.base.Grid;
import light.mvc.pageModel.base.PageFilter;
import light.mvc.pageModel.record.Holiday;
import light.mvc.service.record.HolidayServiceI;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping( { "/holiday" })
public class HolidayController extends BaseController {
	@Autowired
	private HolidayServiceI holidayService;

	@RequestMapping( { "/record" })
	public String manager() {
		return "/record/holiday";
	}

	@RequestMapping( { "/dataGrid" })
	@ResponseBody
	public Grid dataGrid(Holiday holiday, PageFilter ph) {
		Grid grid = new Grid();
		grid.setRows(this.holidayService.dataGrid(holiday, ph));
		grid.setTotal(this.holidayService.count(holiday, ph));
		return grid;
	}
}
